package com.ihc.android.datasource;

import com.ihc.android.utilities.Constants;

public class Device {

	private long id;
	private String macAddress;
	private String name;

	public Device() {
		this(0, "", "");
	}
	
	public Device(long id) {
		this(id, "", "");
	}
	
	public Device(String macAddress, String name) {
		this(0, macAddress, name);
	}
	
	public Device(long id, String macAddress, String name) {
		this.id = id;
		this.macAddress = macAddress;
		this.name = name;
	}
	
	public long getId() {
		return id;
	}
	
	public void setId(long id) {
		this.id = id;
	}
	
	public String getMacAddress() {
		return macAddress;
	}
	
	public void setMacAddress(String macAddress) {
		this.macAddress = macAddress;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	@Override
	public String toString() {
		if (this.macAddress.length() > 0 && this.name.length() > 0) {
			return this.name + "\n" + this.macAddress;
		} else if (this.name.length() > 0) {
			return this.name;
		} else if (this.macAddress.length() > 0) {
			return this.macAddress;
		} else {
			return "<nome desconhecido>";
		}
	}
	
	public String toMsgBluetooth() {
		return Long.toString(this.id) + Constants.separator + this.name + Constants.separator + this.macAddress;
	}
}
